import { Progress } from "antd";
import dayjs from "dayjs";

function getcolumns(setdrawer) {
  return {
    columns: [
      {
        title: "维保项目",
        dataIndex: "name",
        key: "name",
        width: 250,
        render: (text, row) => {
          return <span>{row?.contract_project?.name}</span>;
        },
      },
      {
        title: "接单人",
        dataIndex: "user_name",
        key: "user_name",
      },
      {
        title: "维保开始时间",
        dataIndex: "start_date",
        key: "start_date",
        search: false,
        render: (text, row) => {
          return (
            <span>
              {row?.start_date
                ? dayjs(row?.start_date)?.format("YYYY-MM-DD HH:mm:ss")
                : "-"}
            </span>
          );
        },
      },
      {
        title: "维保结束时间",
        dataIndex: "end_date",
        key: "end_date",
        search: false,
        render: (text, row) => {
          return (
            <span>
              {row?.end_date
                ? dayjs(row?.end_date)?.format("YYYY-MM-DD HH:mm:ss")
                : "-"}
            </span>
          );
        },
      },
      {
        title: "处理进度",
        dataIndex: "progress",
        key: "progress",
        search: false,
        render: (text, row) => {
          return (
            <div className="center">
              <Progress type="dashboard" percent={row?.progress} size={20} />
              <span style={{padding:"2px 0 0 4px"}}>{row?.progress}%</span>
            </div>
          );
        },
      },
      {
        title: "是否推送",
        dataIndex: "is_pushed",
        key: "is_pushed",
        search: false,
      },
      {
        title: "接单时间",
        dataIndex: "receive_order_time",
        key: "receive_order_time",
        search: false,
        render: (text, row) => {
          return (
            <span>
              {row?.receive_order_time
                ? dayjs(row?.receive_order_time)?.format("YYYY-MM-DD HH:mm:ss")
                : "-"}
            </span>
          );
        },
      },
      {
        title: "开始处理时间",
        dataIndex: "start_handle_time",
        key: "start_handle_time",
        search: false,
        render: (text, row) => {
          return (
            <span>
              {row?.start_handle_time
                ? dayjs(row?.start_handle_time)?.format("YYYY-MM-DD HH:mm:ss")
                : "-"}
            </span>
          );
        },
      },
      {
        title: "完成处理时间",
        dataIndex: "complete_time",
        key: "complete_time",
        search: false,
        render: (text, row) => {
          return (
            <span>
              {row?.complete_time
                ? dayjs(row?.complete_time)?.format("YYYY-MM-DD HH:mm:ss")
                : "-"}
            </span>
          );
        },
      },
    ],
    pathconfig: {
      enableadd: false,
      enableedit: false,
      enabledelete: false,
      enabledetail: false,
      add: "/contract_project_plan",
      edit: "/contract_project_plan",
      list: "/contract_project_plan",
      delete: "/contract_project_plan",
      detail: "",
    },
  };
}
export default getcolumns;
